package cn.dxh.stagefinal.service.impl;

import cn.dxh.stagefinal.bean.Matter;
import cn.dxh.stagefinal.bean.Vehicle;
import cn.dxh.stagefinal.dao.MatterDao;
import cn.dxh.stagefinal.service.MatterService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author: Panjianwei
 * @date: 2019/12/10 11:53
 * 代码是一门艺术，需要我们细细用心品味！
 */
@Service
public class MatterServiceImpl implements MatterService {
    @Autowired
private MatterDao matterDao;
    @Override
    public PageInfo<Matter> findAllMatter(int pageindex, int pagesize, String itemsName) {
        PageHelper.startPage(pageindex,pagesize);
        List<Matter> matterAll = matterDao.findMatterAll(itemsName);
        PageInfo pageInfo = new PageInfo(matterAll);
        return pageInfo;
    }
    @Override
    public List<Matter> getall() {
        return matterDao.findMatterAll(null);
    }
    @Override
    public Matter findbyitemsid(int itemsid) {
        return matterDao.findbyitemsid(itemsid);
    }

    @Override
    public int updatematter(Matter matter) {
        return matterDao.updatematter(matter);
    }

    @Override
    public int addmater(String itemsname) {
        return matterDao.addmater(itemsname);
    }
}
